package com.hys.controller;


import com.hys.common.Result;
import com.hys.service.DictService;
import com.hys.vo.DictVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 * 用户信息
 *
 * @author cheer
 */
@RestController
@Api(tags = "字典表")
@RequestMapping("/dict")
public class DictController {

    @Autowired
    private DictService dictService;

    @GetMapping("getByDictType")
    @ApiOperation(value = "获取字典", notes = "<p>企业类型:enterType  " +
            "企业大小:enterSize 审批状态:status " +
            "对应专业:major </p>")
    public Result<List<DictVO>> getByDictType(String typeName){
        List<DictVO> list = dictService.getByDictType(typeName);
        return Result.success(list);
    }

    @GetMapping("listByDictType")
    @ApiOperation(value = "多个字典", notes = "根据字典名称获取")
    public Result<Map<String, List<DictVO>>> listByDictType(String[] typeNames){
        Map<String, List<DictVO>> map = dictService.listByDictType(Arrays.asList(typeNames.clone()));
        return Result.success(map);
    }



}
